package club.tclyq.good_time.photowall.type.controller;

import club.tclyq.good_time.photowall.type.service.PhotoTypeService;
import club.tclyq.good_time.upload.bean.PhotoType;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author tanchong
 * Create Date: 2019/2/24
 */
@RestController
@RequestMapping("/api/v1/photo_type")
public class PhotoTypeController {

    private PhotoTypeService photoTypeService;

    public PhotoTypeController(PhotoTypeService photoTypeService) {
        this.photoTypeService = photoTypeService;
    }

    @GetMapping
    public List<PhotoType> getAllType(){
        return photoTypeService.getAll();
    }

    @PostMapping
    public void createPhotoType(@RequestBody PhotoType photoType) throws IllegalAccessException {
        photoTypeService.createPhotoType(photoType);
    }
}
